package map;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class MapDemo2 {
    public static void main(String[] args) {
        Map<String,Integer> map=new HashMap<>();
        map.put("语文",98);
        map.put("数学",99);
        map.put("英语",100);
        map.put("地理",97);
        map.put("化学",96);
        map.put("物理",95);
        map.put("生物",94);
        System.out.println(map);
        System.out.println(map.keySet());
        Set<String> keySet=map.keySet();
        for (String key:keySet){
            System.out.println(key);
        }

        Set<Map.Entry<String,Integer>> enrtySet=map.entrySet();
        for (Map.Entry<String,Integer> e: enrtySet){
            String key=e.getKey();
            Integer value=e.getValue();
            System.out.println(key+":"+value);
        }

        map.forEach((String k,Integer v)->{
            System.out.println(k+":"+v);
        });

        Collection<Integer> values=map.values();
        for (Integer value:values){
            System.out.println("value:"+value);
        }

        values.forEach(System.out::println);
    }
}
